const App = getApp();
const wxParse = require("../../wxParse/wxParse.js");

Page({
  data: {
    detail: {}
  },
  onLoad: function (options) {
    let roomId = options.id;
    this.loadData(roomId)
  },
  //加载数据
  loadData(id){
    let _this = this;
    App._get('room/detail', {
      room_id: id
    }, function (result) {
      let detail = result.data.detail;
      // 富文本转码
      if (detail.room_content.length > 0) {
        wxParse.wxParse('content', 'html', detail.room_content, _this, 0)
      }
      _this.setData({
        detail
      });
    });
  }
})